package com.dwin.dingnuo.http;


import com.dwin.dingnuo.http.beans.BackModel;
import com.dwin.dingnuo.http.beans.ResponseTokenVerify;
import com.dwin.dingnuo.http.response.RspDeviceDetail;
import com.dwin.dingnuo.http.response.RspDeviceList;
import com.dwin.dingnuo.http.response.RspImageVCode;

import java.util.Map;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

public interface UserMgrService {

    String LANGUAGE = "Accept-Language";
    String PLATFORM = "platform";
    String AUTH = "auth";

    // 获取图形验证码
    @GET("client/vCode/getImageVCode")
    Call<RspImageVCode> getImageVCode(@Header(PLATFORM) String platform,
                                      @Header(LANGUAGE) String language,
                                      @Query("key") String key,
                                      @Query("type") int type);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/client/members/login")
    Call<ResponseTokenVerify> clientLogin(@Header(PLATFORM) String platform,
                                          @Header(LANGUAGE) String language,
                                          @Body RequestBody body);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/client/members/password/update")
    Call<BackModel> clientPwdUpdate(@Header(PLATFORM) String platform,
                                    @Header(LANGUAGE) String language,
                                    @Header(AUTH) String auth,
                                    @Body RequestBody body);


    //获取验证码(邮箱，或手机验证码)
    @GET("/client/vCode/getVCode")
    Call<BackModel> getVCode(@Header("platform") String platform,
                             @Header("language") String language,
                             @QueryMap Map<String, String> map);

    //忘记密码（需要在登录）
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/client/members/password/reset")
    Call<ResponseTokenVerify> passwordReset(@Header(PLATFORM) String platform,
                                            @Header(LANGUAGE) String language,
                                            @Body RequestBody body);

    // ----------------------------------------------------------------------------------------RspDeviceList-----
    @GET("/client/device/getList")
    Call<RspDeviceList> getDeviceList(@HeaderMap Map<String, String> headers, @QueryMap Map<String, String> map);

    @GET("/client/device/getDetails")
    Call<RspDeviceDetail> getDeviceDetail(@Header(PLATFORM) String platform,
                                          @Header(LANGUAGE) String language,
                                          @Header(AUTH) String auth,
                                          @QueryMap Map<String, String> map);

    // 修改设备名称。
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/client/device/edit")
    Call<BackModel> deviceEdit(@Header(PLATFORM) String platform,
                               @Header(LANGUAGE) String language,
                               @Header(AUTH) String auth,
                               @Body RequestBody body);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/client/device/del")
    Call<BackModel> deviceDelete(@Header(PLATFORM) String platform,
                                 @Header(LANGUAGE) String language,
                                 @Header(AUTH) String auth,
                                 @Body RequestBody body);

    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/client/device/addDeviceByQRCode")
    Call<BackModel> addDeviceByQRCode(@Header(PLATFORM) String platform,
                                      @Header(LANGUAGE) String language,
                                      @Header(AUTH) String auth,
                                      @Body RequestBody body);

    // ---------------------------------------------------------------------------------------------
    // 添加日志（暂未使用到）
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("/client/logs/add")
    Call<BackModel> addClientLogs(@Header(PLATFORM) String platform,
                                  @Header(LANGUAGE) String language,
                                  @Header(AUTH) String auth,
                                  @Body RequestBody body);

}
